﻿using System;
using System.Collections.Generic;
using RamGecXNAControls;
using Fusion;
using RamGecXNAControls.ExtendedControls;
using Fusion.Management;
using Fusion.Content;
using Microsoft.Xna.Framework;

namespace Client.Game_States.Game_GUI_s
{
    public class NewCharacterGUI
    {
        // Data Members
        public GUIManager NewCharManager;
        private MessageBox ErrorMessage;
        private GameTexture BorderShadow;
        public Window NewCharWindow;

        // Constructor
        public NewCharacterGUI()
        {
            NewCharManager = new GUIManager(FusionGame.MainGame, "Themes", "Default");
            NewCharManager.LoadControls(@"Content\Menus\NewCharacter.mnu");

            BorderShadow = GFXHelper.LoadInterfaceTexture(@"BorderShade");

            NewCharWindow = (Window)NewCharManager.GetControl("WndNewChar");
            NewCharWindow.Bounds.Location = new Point(640 - (NewCharWindow.Bounds.Width >> 1), 360 - (NewCharWindow.Bounds.Height >> 1));
        }

        // Methods
        public void Update()
        {
            NewCharManager.Update(FusionGame.CurrentTime);
        }
        public void Render()
        {
            FCanvas.Draw(BorderShadow, new Vector2(0, 620), Color.White);
            FCanvas.Draw(BorderShadow, Vector2.Zero, BorderShadow.Texture.Bounds, Color.White, 0f, Vector2.Zero, 1f, Microsoft.Xna.Framework.Graphics.SpriteEffects.FlipVertically, 1f);
            NewCharManager.Draw(FCanvas.Batch);
        }
        public void Dispose()
        {
            NewCharManager.Controls.Clear();
            BorderShadow.Release();
        }
        public void ShowError(string Message)
        {
            ErrorMessage = new MessageBox(NewCharManager, Message);
            ErrorMessage.ButtonIcon = NewCharManager.Theme.IconWarning;
            ErrorMessage.Show();
        }
    }
}
